#ifndef POINT_H_
#define POINT_H_

#include <cmath>

struct Point{
	float x1;
	float x2;
	float x3;

	Point(){
		this->x1 = 0.0f;
		this->x2 = 0.0f;
		this->x3 = 0.0f;
	}

	Point(float x1,float x2,float x3=0.0f){
		this->x1 = x1;
		this->x2 = x2;
		this->x3 = x3;
	}

	bool operator ==(const Point& p2){
		return (this->x1==p2.x1&&this->x2==p2.x2&&this->x3==p2.x3);
	}

	Point operator-(const Point& p2)const{
		return Point (this->x1-p2.x1,this->x2-p2.x2,this->x3-p2.x3);
	}

	Point operator+(const Point& p2)const{
		return Point (this->x1+p2.x1,this->x2+p2.x2,this->x3+p2.x3);
	}

	Point& operator+=(const Point& p2){
		this->x1+=p2.x1;
		this->x2+=p2.x2;
		this->x3+=p2.x3;
		return (*this);
	}

	Point& operator*=(const float k){
		this->x1*=k;
		this->x2*=k;
		this->x3*=k;
		return *this;
	}

	Point operator*(const float k){
		return Point(this->x1*k,this->x2*k,this->x3*k);
	}

	void rotateXY(float xyangle){
		 float tx1 = x1*cos(xyangle)-sin(xyangle)*x2;
		 float tx2 = x1*sin(xyangle)+cos(xyangle)*x2;
		 float tx3 = x3;

		 x1=tx1;
		 x2=tx2;
		 x3=tx3;
	}

	void rotateXZ(float xzangle){
		float tx1 = x1*cos(xzangle)-sin(xzangle)*x3;
		float tx2 = x2;
		float tx3 = sin(xzangle)*x1+cos(xzangle)*x3;

		x1=tx1;
		x2=tx2;
		x3=tx3;
	}
};

#endif /* POINT_H_ */
